package com.etc.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.etc.dao.VideoDao;
import com.etc.entity.MusicVideo;
import com.etc.util.DBUtil;


public class VideoDaoImpl implements VideoDao{

	@Override
	public MusicVideo findByVideoId(String videoId) {
		MusicVideo musicVideo = null;
		ResultSet rs = DBUtil.query("select video_id,video_name,music_video_img_path from music_video where video_id=?",videoId);
		try {
			while (rs.next()) {
				musicVideo = new MusicVideo();
				musicVideo.setVideoId(Integer.parseInt(videoId));
				musicVideo.setVideoName(rs.getString("video_name"));
				musicVideo.setMusiVideoImgPath(rs.getString("music_video_img_path"));
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return musicVideo;
	}

}
